<template>
  <div>购物车页面</div>
  <ul>
    <li v-for="item in cartArr" :key="item.id">
      {{ item.proname }}--{{ item.price }}
    </li>
  </ul>
  <!-- 计算属性 -->
  <hr />
  <ul>
    <li v-for="item in filtercart" :key="item.id">
      {{ item.proname }}--{{ item.price }}
    </li>
  </ul>
  <button @click="addcarFn">添加购物车</button>
</template>

<script setup>
import { useCartStore } from "@/store/modules/cartModules";
const cartStore = useCartStore();
console.log("cartStore", cartStore);
const { cartArr, filtercart, addCart } = cartStore;
const addcarFn = () => {
  addCart({
    id: 3,
    proname: "huawei mate14",
    price: 8000,
  });
};
</script>
<style scoped>
</style>